<?php



function getFittingContent($fitting_req) {
	
	$fittings_content = file_get_contents('fittings_list.dat', true);
	
	#$fittings_file = "fittings_list.dat";
	#$fittings_content = file($fittings_file);

	//put content in array
	$fittings = explode("<EndOfFitting>\n", $fittings_content);
	foreach ($fittings as $this_fitting) {
		$i = 0;
		$lines = explode("\n", $this_fitting);
		$title = $lines[0];
		#foreach ($lines as $this_line) {
		#	echo "$i: $this_line<br>";
		#	$i++;
		#	
		#}
		if (strcmp($title, $fitting_req) == 0) {
			return $this_fitting;
		}
	}


	return ("Paste your preferred fitting here.".$fitting_req);
	
}







$fitting_desc = NULL;
if (isset($_REQUEST['fitting_desc']) == true) {
	$fitting_desc = $_REQUEST['fitting_desc'];
}

echo getFittingContent($fitting_desc);



?>